package org.testis.webautomationmodule.ui.objects;

import org.testis.logging.AtofLogLevel;
import org.testis.webautomationmodule.ui.UIFormFieldDecorator;


public class UIWindow extends UIFormFieldDecorator
{

    public UIWindow(String id)
    {
        super(id);
    }


    @Override
    protected boolean setBehavior()
    {
        try {
            getWebAutomationImpl().previousWindowIds.push(
                getWebAutomationImpl().currentWindowId);
            getWebAutomationImpl().previousFramePaths.put(
                getWebAutomationImpl().currentWindowId,
                getWebAutomationImpl().currFramePath);
            getWebAutomationImpl().selectWindow(getId());
            getWebAutomationImpl().currentWindowId = getId();
            putLog(" Selecting windows with id " + getId(),AtofLogLevel.INFO);
            return true;
        } catch (Exception ex) {
            putLog(" could not select window with id " + getId(),AtofLogLevel.ERROR);
            return false;
        }
    }


    @Override
    public boolean verifyBehavior()
    {
        return setBehavior();
    }


    @Override
    public boolean getBehavior()
    {
        return setBehavior();
    }
}

